﻿using System;
using HslCommunication.Core.Net;
using HslCommunication.Reflection;

namespace HslCommunication.Profinet.Keyence
{
	/// <summary>
	/// 基恩士的SR2000的扫码设备，可以进行简单的交互
	/// </summary>
	/// <remarks>
	/// 当使用 "LON","LOFF","PRON","PROFF" 命令时，在发送时和发生错误时，将不会收到扫码设备的回发命令，而是输出读取结果。
	/// 如果也希望获取上述命令的响应时，请在以下位置进行设置。[设置列表]-[其他]-"指定基本命令的响应字符串"
	/// </remarks>
	// Token: 0x02000092 RID: 146
	public class KeyenceSR2000SeriesTcp : NetworkDoubleBase, IKeyenceSR2000Series
	{
		/// <summary>
		/// 实例化基恩士的SR2000的扫码设备通讯对象<br />
		/// Instantiate keyence's SR2000 scan code device communication object
		/// </summary>
		// Token: 0x06000B15 RID: 2837 RVA: 0x000423EE File Offset: 0x000405EE
		public KeyenceSR2000SeriesTcp()
		{
			this.receiveTimeOut = 10000;
			base.SleepTime = 20;
		}

		/// <summary>
		/// 指定ip地址及端口号来实例化一个基恩士的SR2000的扫码设备通讯对象<br />
		/// Specify the ip address and port number to instantiate a keyence SR2000 scan code device communication object
		/// </summary>
		/// <param name="ipAddress">PLC的Ip地址</param>
		/// <param name="port">PLC的端口</param>
		// Token: 0x06000B16 RID: 2838 RVA: 0x0004240C File Offset: 0x0004060C
		public KeyenceSR2000SeriesTcp(string ipAddress, int port)
		{
			this.IpAddress = ipAddress;
			this.Port = port;
			this.receiveTimeOut = 10000;
			base.SleepTime = 20;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.ReadBarcode(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B17 RID: 2839 RVA: 0x0004243A File Offset: 0x0004063A
		[HslMqttApi]
		public OperateResult<string> ReadBarcode()
		{
			return KeyenceSR2000Helper.ReadBarcode(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.Reset(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B18 RID: 2840 RVA: 0x0004244D File Offset: 0x0004064D
		[HslMqttApi]
		public OperateResult Reset()
		{
			return KeyenceSR2000Helper.Reset(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.OpenIndicator(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B19 RID: 2841 RVA: 0x00042460 File Offset: 0x00040660
		[HslMqttApi]
		public OperateResult OpenIndicator()
		{
			return KeyenceSR2000Helper.OpenIndicator(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.CloseIndicator(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B1A RID: 2842 RVA: 0x00042473 File Offset: 0x00040673
		[HslMqttApi]
		public OperateResult CloseIndicator()
		{
			return KeyenceSR2000Helper.CloseIndicator(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.ReadVersion(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B1B RID: 2843 RVA: 0x00042486 File Offset: 0x00040686
		[HslMqttApi]
		public OperateResult<string> ReadVersion()
		{
			return KeyenceSR2000Helper.ReadVersion(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.ReadCommandState(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B1C RID: 2844 RVA: 0x00042499 File Offset: 0x00040699
		[HslMqttApi]
		public OperateResult<string> ReadCommandState()
		{
			return KeyenceSR2000Helper.ReadCommandState(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.ReadErrorState(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B1D RID: 2845 RVA: 0x000424AC File Offset: 0x000406AC
		[HslMqttApi]
		public OperateResult<string> ReadErrorState()
		{
			return KeyenceSR2000Helper.ReadErrorState(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.CheckInput(System.Int32,System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B1E RID: 2846 RVA: 0x000424BF File Offset: 0x000406BF
		[HslMqttApi]
		public OperateResult<bool> CheckInput(int number)
		{
			return KeyenceSR2000Helper.CheckInput(number, new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.SetOutput(System.Int32,System.Boolean,System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B1F RID: 2847 RVA: 0x000424D3 File Offset: 0x000406D3
		[HslMqttApi]
		public OperateResult SetOutput(int number, bool value)
		{
			return KeyenceSR2000Helper.SetOutput(number, value, new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.ReadRecord(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B20 RID: 2848 RVA: 0x000424E8 File Offset: 0x000406E8
		[HslMqttApi]
		public OperateResult<int[]> ReadRecord()
		{
			return KeyenceSR2000Helper.ReadRecord(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.Lock(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B21 RID: 2849 RVA: 0x000424FB File Offset: 0x000406FB
		[HslMqttApi]
		public OperateResult Lock()
		{
			return KeyenceSR2000Helper.Lock(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.UnLock(System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B22 RID: 2850 RVA: 0x0004250E File Offset: 0x0004070E
		[HslMqttApi]
		public OperateResult UnLock()
		{
			return KeyenceSR2000Helper.UnLock(new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Keyence.KeyenceSR2000Helper.ReadCustomer(System.String,System.Func{System.Byte[],HslCommunication.OperateResult{System.Byte[]}})" />
		// Token: 0x06000B23 RID: 2851 RVA: 0x00042521 File Offset: 0x00040721
		[HslMqttApi]
		public OperateResult<string> ReadCustomer(string command)
		{
			return KeyenceSR2000Helper.ReadCustomer(command, new Func<byte[], OperateResult<byte[]>>(base.ReadFromCoreServer));
		}

		/// <inheritdoc />
		// Token: 0x06000B24 RID: 2852 RVA: 0x00042535 File Offset: 0x00040735
		public override string ToString()
		{
			return string.Format("KeyenceSR2000SeriesTcp[{0}:{1}]", this.IpAddress, this.Port);
		}
	}
}
